﻿using Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Server
{
    public class Agv指令
    {
        internal static void  行驶管控(long AgvID, bool 停止, string IP)
        {
            var cmd =new byte[8];
           _=  Tools.向AGV发送指令(IP,常量.Agv接收端口,cmd);
        }
        internal static void 行驶(long AgvID, int 路由编号, string IP)
        {
            var cmd = new byte[8];
            _ = Tools.向AGV发送指令(IP, 常量.Agv接收端口, cmd);
        }


        internal static void 上层传输(long AgvID, bool 收料, string IP)
        {
            var cmd = new byte[8];
            _ = Tools.向AGV发送指令(IP, 常量.Agv接收端口, cmd);
        }

        internal static void 下层传输(long AgvID, bool 收料, string IP)
        {
            var cmd = new byte[8];
            _ = Tools.向AGV发送指令(IP, 常量.Agv接收端口, cmd);
        }


        /// <summary>
        /// 同时上下传输
        /// </summary>
        /// <param name="AgvID"></param>
        /// <param name="上层出料">AGV是否上层出料</param>
        /// <returns></returns>
        internal static void 上下传输(long AgvID, bool 上层出料, string IP)
        {
            var cmd = new byte[8];
            _ = Tools.向AGV发送指令(IP, 常量.Agv接收端口, cmd);
        }

        /// <summary>
        /// 传输正常完成
        /// </summary>
        /// <param name="AgvID"></param>
        /// <returns></returns>
        internal static void 完成传输(long AgvID, string IP)
        {
            var cmd = new byte[8];
            _ = Tools.向AGV发送指令(IP, 常量.Agv接收端口, cmd);
        }

        /// <summary>
        /// 传输过程中要求停止
        /// </summary>
        /// <param name="AgvID"></param>
        /// <returns></returns>
        internal static void 停止传输(long AgvID,string IP)
        {
            var cmd = new byte[8];
            _ = Tools.向AGV发送指令(IP, 常量.Agv接收端口, cmd);
        }



        /// <summary>
        /// 解析AGV传输过来的指令
        /// 使用struct，减少GC提交性能
        /// </summary>
        /// <param name="Data"></param>
        /// <returns></returns>
        public static AgvReceiveData? 解析指令(byte[] Data)
        {
            return null;
        }
         
    }

    public struct AgvReceiveData
    {
        public int AgvID { get; set; }
        public int X { get; set; }
        public int Y { get; set; }

        public Agv状态 Status { get; set; }
        public bool UpFull { get; set; }
        public bool DownFull { get; set; } 
    }
}
